var t = require("../common").getProjectNameLang, e = getApp(), o = e.getNetAddresss("plugin.store-projects.frontend.project-service.get-service-info"), n = e.getNetAddresss("plugin.store-projects.frontend.project-order.qr-code-url");

Page({
    data: {
        projectId: null,
        project: {},
        projectQRCode: ""
    },
    onLoad: function(e) {
        if (!e.project_order_id) return wx.showToast({
            title: t() + "不存在",
            icon: "none"
        }), void wx.navigateBack({
            delta: 1
        });
        this.setData({
            projectId: e.project_order_id
        }), this.getProject(), this.getMiniProgramCode();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.getProject();
    },
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getProject: function() {
        var t = this;
        wx.showLoading(), e._getNetWork({
            url: o,
            data: {
                id: this.data.projectId
            },
            success: function(e) {
                var o = e.data, n = o.data, r = o.result, i = o.msg;
                wx.hideLoading(), 0 !== r ? t.setData({
                    project: n
                }) : wx.showToast({
                    title: i,
                    icon: "none"
                });
            }
        });
    },
    getMiniProgramCode: function() {
        var t = this;
        e._getNetWork({
            url: n,
            data: {
                id: this.data.projectId
            },
            success: function(e) {
                var o = e.data, n = o.data.miQrCodeUrl, r = o.result, i = o.msg;
                0 !== r ? "string" == typeof n ? t.setData({
                    projectQRCode: n
                }) : wx.showToast({
                    title: n.message,
                    icon: "none"
                }) : wx.showToast({
                    title: i,
                    icon: "none"
                });
            }
        });
    }
});